using System;
using System.Collections.Generic;
using Betfair.Api.Types;
using Newtonsoft.Json;

namespace Betfair.Api
{
    public sealed class MarketBook
    {
        public MarketBook(string id, bool isDataDelayed, MarketStatus status, int betDelay, bool isBspReconciled,
            bool complete, bool inPlay, int noOfWinners, int noOfRunners, int noOfActiveRunners,
            DateTime lastOrderExecution, double matched, double available, bool isCrossMatching, bool hasRunnersVoidable,
            long version, IList<Runner> runners)
        {
            Id = id;
            IsDataDelayed = isDataDelayed;
            Status = status;
            BetDelay = betDelay;
            IsBspReconciled = isBspReconciled;
            Complete = complete;
            InPlay = inPlay;
            NoOfWinners = noOfWinners;
            NoOfRunners = noOfRunners;
            NoOfActiveRunners = noOfActiveRunners;
            LastOrderExecution = lastOrderExecution;
            Matched = matched;
            Available = available;
            IsCrossMatching = isCrossMatching;
            HasRunnersVoidable = hasRunnersVoidable;
            Version = version;
            Runners = runners;
        }

        [JsonProperty("marketId")]
        public string Id { get; private set; }

        [JsonProperty("isMarketDataDelayed")]
        public bool IsDataDelayed { get; private set; }

        [JsonProperty("status")]
        public MarketStatus Status { get; private set; }

        [JsonProperty("betDelay")]
        public int BetDelay { get; private set; }

        [JsonProperty("bspReconciled")]
        public bool IsBspReconciled { get; private set; }

        [JsonProperty("complete")]
        public bool Complete { get; private set; }

        [JsonProperty("inPlay")]
        public bool InPlay { get; private set; }

        [JsonProperty("numberOfWinners")]
        public int NoOfWinners { get; private set; }

        [JsonProperty("numberOfRunners")]
        public int NoOfRunners { get; private set; }

        [JsonProperty("numberOfActiveRunners")]
        public int NoOfActiveRunners { get; private set; }

        [JsonProperty("lastMatchTime")]
        public DateTime LastOrderExecution { get; private set; }

        [JsonProperty("totalMatched")]
        public double Matched { get; private set; }

        [JsonProperty("totalAvailable")]
        public double Available { get; private set; }

        [JsonProperty("crossMatching")]
        public bool IsCrossMatching { get; private set; }

        [JsonProperty("runnersVoidable")]
        public bool HasRunnersVoidable { get; private set; }

        [JsonProperty("version")]
        public long Version { get; private set; }

        [JsonProperty("runners")]
        public IList<Runner> Runners { get; private set; }
    }
}